create table inspection_basic
(
    id                           bigint identity
        constraint table_name_pk
            primary key nonclustered,
    inspection_type              varchar(255),
    inspection_cycle             varchar(255),
    inspection_cycle_total_score int,
    date_create                  datetime,
    is_del                       int default 0
)
go

exec sp_addextendedproperty 'MS_Description', '考核基础', 'SCHEMA', 'dbo', 'TABLE', 'inspection_basic'
go

exec sp_addextendedproperty 'MS_Description', '考核类别', 'SCHEMA', 'dbo', 'TABLE', 'inspection_basic', 'COLUMN',
     'inspection_type'
go

exec sp_addextendedproperty 'MS_Description', '考核周期', 'SCHEMA', 'dbo', 'TABLE', 'inspection_basic', 'COLUMN',
     'inspection_cycle'
go

exec sp_addextendedproperty 'MS_Description', '考核分数', 'SCHEMA', 'dbo', 'TABLE', 'inspection_basic', 'COLUMN',
     'inspection_cycle_total_score'
go

create table inspection_branch
(
    id                  bigint identity
        constraint inspection_branch_pk
            primary key nonclustered,
    branch_name         varchar(255),
    branch_desc         varchar(255),
    related_departments varchar(1024),
    date_create         datetime
)
go

exec sp_addextendedproperty 'MS_Description', '支部', 'SCHEMA', 'dbo', 'TABLE', 'inspection_branch'
go

exec sp_addextendedproperty 'MS_Description', '支部名称', 'SCHEMA', 'dbo', 'TABLE', 'inspection_branch', 'COLUMN',
     'branch_name'
go

exec sp_addextendedproperty 'MS_Description', '支部描述', 'SCHEMA', 'dbo', 'TABLE', 'inspection_branch', 'COLUMN',
     'branch_desc'
go

exec sp_addextendedproperty 'MS_Description', '关联的部门', 'SCHEMA', 'dbo', 'TABLE', 'inspection_branch', 'COLUMN',
     'related_departments'
go

create table inspection_department
(
    id          bigint identity
        constraint inspection_department_pk
            primary key nonclustered,
    dept_name   varchar(100),
    dept_desc   varchar(255),
    date_create date,
    branch_id   bigint,
    dept_type   int
)
go

exec sp_addextendedproperty 'MS_Description', '部门', 'SCHEMA', 'dbo', 'TABLE', 'inspection_department'
go

exec sp_addextendedproperty 'MS_Description', '部门名称', 'SCHEMA', 'dbo', 'TABLE', 'inspection_department', 'COLUMN',
     'dept_name'
go

exec sp_addextendedproperty 'MS_Description', '部门描述', 'SCHEMA', 'dbo', 'TABLE', 'inspection_department', 'COLUMN',
     'dept_desc'
go

exec sp_addextendedproperty 'MS_Description', '支部id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_department', 'COLUMN',
     'branch_id'
go

exec sp_addextendedproperty 'MS_Description', '部门类型 1考核部门 0非考核部门', 'SCHEMA', 'dbo', 'TABLE', 'inspection_department',
     'COLUMN', 'dept_type'
go

create table inspection_dept_regulation
(
    id            bigint identity
        constraint inspection_dept_regulation_pk
            primary key nonclustered,
    dept_id       bigint,
    regulation_id bigint,
    date_create   datetime
)
go

exec sp_addextendedproperty 'MS_Description', '部门条例 权限', 'SCHEMA', 'dbo', 'TABLE', 'inspection_dept_regulation'
go

exec sp_addextendedproperty 'MS_Description', '部门id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_dept_regulation', 'COLUMN',
     'dept_id'
go

exec sp_addextendedproperty 'MS_Description', '条例id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_dept_regulation', 'COLUMN',
     'regulation_id'
go

create table inspection_dictionary
(
    id             bigint identity
        constraint inspection_dictionary_pk
            primary key nonclustered,
    dict_key       varchar(50),
    dict_key_name  varchar(255),
    dict_value     varchar(255),
    dic_value_name varchar(255),
    remark         varchar(255),
    order_num      int,
    is_del         int
)
go

exec sp_addextendedproperty 'MS_Description', '考核系统字典表', 'SCHEMA', 'dbo', 'TABLE', 'inspection_dictionary'
go

exec sp_addextendedproperty 'MS_Description', '字典key', 'SCHEMA', 'dbo', 'TABLE', 'inspection_dictionary', 'COLUMN',
     'dict_key'
go

create table inspection_event
(
    id                 bigint identity
        constraint inspection_event_pk
            primary key nonclustered,
    execute_dept       bigint,
    inspect_branch     bigint,
    inspect_dept       bigint,
    event_create_date  datetime,
    event_inspect_date datetime,
    event_content      varchar(1024),
    inspect_score      int,
    inspect_desc       varchar(1024),
    regulation_id      bigint,
    date_create        datetime,
    inspection_type    varchar(100),
    remark             varchar(255)
)
go

exec sp_addextendedproperty 'MS_Description', '考核事件', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event'
go

exec sp_addextendedproperty 'MS_Description', '考核执行的部门', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'execute_dept'
go

exec sp_addextendedproperty 'MS_Description', '支部id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'inspect_branch'
go

exec sp_addextendedproperty 'MS_Description', '被考核的部门', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'inspect_dept'
go

exec sp_addextendedproperty 'MS_Description', '事件发生日期', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'event_create_date'
go

exec sp_addextendedproperty 'MS_Description', '事件考核日期', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'event_inspect_date'
go

exec sp_addextendedproperty 'MS_Description', '事件内容
', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN', 'event_content'
go

exec sp_addextendedproperty 'MS_Description', '考核分数', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'inspect_score'
go

exec sp_addextendedproperty 'MS_Description', '考核说明', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'inspect_desc'
go

exec sp_addextendedproperty 'MS_Description', '考核条例id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'regulation_id'
go

exec sp_addextendedproperty 'MS_Description', '考核类型', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN',
     'inspection_type'
go

exec sp_addextendedproperty 'MS_Description', 'remark', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event', 'COLUMN', 'remark'
go

create table inspection_event_dept_relation
(
    id                  bigint not null
        primary key,
    inspection_event_id bigint not null,
    inspection_dept_id  bigint not null
)
go

exec sp_addextendedproperty 'MS_Description', '事件id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event_dept_relation',
     'COLUMN', 'inspection_event_id'
go

exec sp_addextendedproperty 'MS_Description', '部门id', 'SCHEMA', 'dbo', 'TABLE', 'inspection_event_dept_relation',
     'COLUMN', 'inspection_dept_id'
go

create table inspection_regulation
(
    id                  bigint identity
        constraint inspection_regulation_pk
            primary key nonclustered,
    regulation_name     varchar(255),
    regulation_content  varchar(255),
    inspection_type     varchar(255),
    remark              varchar(255),
    execute_departments varchar(1024),
    highest_score       int,
    lowest_score        int,
    date_create         datetime,
    regulation_no       varchar(255)
)
go

exec sp_addextendedproperty 'MS_Description', '考核条例', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation'
go

exec sp_addextendedproperty 'MS_Description', '条例名称', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'regulation_name'
go

exec sp_addextendedproperty 'MS_Description', '条例内容', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'regulation_content'
go

exec sp_addextendedproperty 'MS_Description', '考核类别', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'inspection_type'
go

exec sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'remark'
go

exec sp_addextendedproperty 'MS_Description', '存在可以执行条例的部门编码的集合 用,分割', 'SCHEMA', 'dbo', 'TABLE',
     'inspection_regulation', 'COLUMN', 'execute_departments'
go

exec sp_addextendedproperty 'MS_Description', '最高分', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'highest_score'
go

exec sp_addextendedproperty 'MS_Description', '最低分', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'lowest_score'
go

exec sp_addextendedproperty 'MS_Description', '条例编号', 'SCHEMA', 'dbo', 'TABLE', 'inspection_regulation', 'COLUMN',
     'regulation_no'
go

create table testuser
(
    id   bigint identity,
    name varchar(50),
    age  int
)
go

